package en.edu.zxj.springrabbimqdemo.listener;

import en.edu.zxj.springrabbimqdemo.constant.Constants;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description：
 *
 * @author: zxj
 * @date: 2024-09-20
 * @time: 15:09:50
 */
@Component
public class DirectListener {
    // 监听队列1
    @RabbitHandler
    @RabbitListener(queues = Constants.DIRECT_QUEUE_NAME1)
    public void directListener1(String message) {
        System.out.println("direct.queue1 收到消息：" + message);
    }

    // 监听队列2
    @RabbitListener(queues = Constants.DIRECT_QUEUE_NAME2)
    public void directListener2(String message) {
        System.out.println("direct.queue2 收到消息：" + message);
    }
}
